package com.spgf.controller.fragments;

import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.Button;

import com.archtecture.model.exceptions.NegocioException;
import com.spgf.controller.R;
import com.spgf.controller.utils.PadraoFragmentAb;
import com.spgf.model.dao.util.DatabaseUtil;

public class FerramentasMnt extends PadraoFragmentAb {

	@Override
	protected ViewGroup configurarViewRoot(LayoutInflater inflater) {
		return (ViewGroup) inflater.inflate(R.layout.fragment_ferramentas, null);
	}

	@Override
	public void configurarTela(ViewGroup root) {

		// Set up the action bar.
		// final ActionBar actionBar = ((MainActivity) inflater.getContext()).getActionBar();

		// Specify that we will be displaying tabs in the action bar.
		// actionBar.setNavigationMode(ActionBar.NAVIGATION_MODE_STANDARD);

		final Button btnExportarBanco = (Button) root.findViewById(R.id.btnExportarBanco);
		btnExportarBanco.setOnClickListener(acaoExecutar);

		final Button btnExportarQuery = (Button) root.findViewById(R.id.btnExportarQuery);
		btnExportarQuery.setOnClickListener(acaoExecutar);

	}

	@Override
	protected void executarClick(View pView) throws NegocioException {

		super.executarClick(pView);

		if (pView.getId() == R.id.btnExportarBanco) {
			DatabaseUtil.getInstance().exportarBancoDados(pView.getContext());
		}

		else if (pView.getId() == R.id.btnExportarQuery) {
			DatabaseUtil.getInstance().exportarBancoQuery(pView.getContext());
		}
	}
}
